package com.project.psc.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.psc.dto.SupplierDto;
import com.project.psc.service.IReturnService;
import com.project.psc.util.SupplierThreadLocal;
import com.project.psc.vo.ReturnVo;
import com.project.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("return")
public class ReturnController {

    @Autowired
    private IReturnService returnService;
    @GetMapping("find")

    public ResultVo find(Integer pageNO) {
        SupplierDto loginUser = SupplierThreadLocal.getSupplier();
        IPage<ReturnVo> returnVoIPage = returnService.find(pageNO, loginUser.getId());
        return ResultVo.ok(returnVoIPage);
    }


    @GetMapping("complete")
    public ResultVo complete(Long id){
        returnService.updateStatus(id);
        return ResultVo.ok();
    }


}
